<script setup lang="ts">
import { FlowBoxContainer } from "@/models/containers";
import Dynamic from "@/components/Dynamic.vue";

const props = defineProps<{ model: FlowBoxContainer }>()

const justifyAlign = props.model.align ?? 'flex-start'

</script>

<template>
    <div class="pybi-flow-box pybi-container" data-pybi-auto-width>

        <Dynamic :component="cp" v-for="cp in props.model.children" :key="cp.id"></Dynamic>

    </div>
</template>

<style scoped lang="less">
.pybi-flow-box {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: v-bind(justifyAlign);
    width: 100%;

    :deep(>.pybi-space[data-auto-grow]) {
        flex-grow: 9999;
    }

    // make container not full width like box,grid box,flow box
    :deep(>*[data-pybi-auto-width]) {
        width: unset;
    }
}
</style>